import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';

///外设蓝牙状态管理
class DeviceConnectStateNotifier extends ChangeNotifier {
  BluetoothDevice? _connectedDevice;

  BluetoothDevice? get connectedDevice => _connectedDevice;

  void setConnectedDevice(BluetoothDevice? device) {
    try {
      _connectedDevice = device;
      notifyListeners();
    } catch (e) {
      // Handle the connection error
      print('Connection failed: ======$e');
    }
  }
}

///全局数据模型改变，状态管理
class GlobalModelNotifier extends ChangeNotifier {
  void updateProgress() {
    try {
      notifyListeners();
    } catch (e) {
      // Handle the connection error
      print('Connection failed: ======$e');
    }
  }
}
